package com.example.websocket.util;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import java.util.concurrent.ConcurrentLinkedQueue;

@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON)
public class QueueHelper<T> {
    private ConcurrentLinkedQueue<T> queue = new ConcurrentLinkedQueue<>();

    public boolean add(T obj){
        return queue.offer(obj);
    }
    public T get(){
        return queue.poll();
    }


}
